package com.otachn.utiils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * @author ching
 *
 */
public class PropertiesUtil {
    private static InputStream in;
    private static Logger logger = Logger.getLogger(PropertiesUtil.class);
    private static Properties prop;
    
    public static void setFile (String fileName) {
    	prop = new Properties();
    	try {
    		in = PropertiesUtil.class.getResourceAsStream(fileName);
			prop.load(in);
			in.close();
		} catch (IOException e) {
			logger.error("PropertiesUtil: " + e.getMessage());
		}
    }

    public static String getPropertyFromFile (String key) {
		return prop.getProperty(key).trim();
    }

    private PropertiesUtil() {
    }

}
